import type { ExtensibleEntityDto } from '../type';

export enum PermissionType {
  Module = 0,
  Menu = 1,
  Button = 2
}

export enum MultiTenancySides {
  Tenant = 1,
  Host = 2,
  Both = MultiTenancySides.Tenant | MultiTenancySides.Host
}

export interface PermissionTreeDto {
  name: string;
  parentName?: string;
  displayName?: string;
  path?: string;
  iocn?: string;
  type?: PermissionType;
  childPermissions?: Array<PermissionTreeDto>;
}

export interface PermissionSet {
  module: Set<string>;
  menu: Set<string>;
  button: Set<string>;
}

export interface PermissionGroupDefinitionDto extends ExtensibleEntityDto<string> {
  name: string;
  displayName: string;
}

export interface PermissionDefinitionDto extends ExtensibleEntityDto<string> {
  name: string;
  displayName: string;
  parentName?: string;
  groupName: string;
  isEnabled: boolean;
  providers: string;
  stateCheckers: string;
  multiTenancySides: MultiTenancySides;
}

export interface PermissionDefinitionViewDto extends ExtensibleEntityDto<string> {
  name: string;
  displayName: string;
  isEnabled: boolean;
  providers: string;
  stateCheckers: string;
  multiTenancySides: MultiTenancySides;
  children?: PermissionDefinitionViewDto[];
}
